Method and system for selecting tunnels to send network traffic through

ABSTRACT

An approach is disclosed for selecting tunnels through which network traffic can be sent to steer the traffic away from congestion hot-spots. In one embodiment, multiple Foo-over-UDP (FOU) tunnels, each having a distinct source port, are created between two endpoints. Probes are scheduled to measure network metrics, such as latency and liveliness, of each of the FOU tunnels. In turn, the network metrics are used to select particular FOU tunnel(s) to send traffic over in a manner that is fair across source and destination IP addresses of the FOU tunnel(s). In particular, scores are assigned to the source and destination IP addresses based on sums of scores assigned to tunnels having those source and destination IP addresses based on the tunnels&#39; performance metrics. A load balancer then splits a number of buckets across the source and destination IP addresses, and ultimately across the tunnels, based on the assigned scores.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims benefit of U.S. provisional patent entitled “Layer 2 Extension Network in a Hybrid Cloud Computing System,” having Ser. No. 62/380,993 and filed on Aug. 29, 2016, which is incorporated herein by reference in its entirety. This application is a continuation-in-part of U.S. patent application entitled “Steering Network Flows Away from Congestion and High Latency Hotspots,” having Ser. No. 15/654,588 and filed on Jul. 19, 2017, which is incorporated herein by reference in its entirety.

This application is related to the patent application entitled “Creating Layer 2 Extension Networks in a Hybrid Cloud Computing System” (Attorney Docket No. D222.02), which is assigned to the assignee of this application and filed on the same day as this application and which is herein incorporated by reference in its entirety.

BACKGROUND

Network latency and throughput of traffic traversing a network are determined by various factors including the number of hops between the source and the destination, congestion in a network path between the source and the destination, branching in the network path, service provider service level agreements, and peering relationships between service providers, among others. In particular, branching in the network path can result from equal cost multi-paths (ECMPs) and link aggregation. Such branching is typically state-less and based on a hash of packets fields, with packets being sent over particular network paths according to the hash of the packet fields. However, this state-less branching of traffic can cause hot spots in some branches leading to congestion and high latency.

SUMMARY

One embodiment provides a computer-implemented method of selecting tunnels to send network traffic through. The method generally includes determining one or more performance metrics for each of a plurality of tunnels routed across distinct network paths between two endpoints, and determining scores for each tunnel of the plurality of tunnels based on at least performance metrics associated with the tunnel. The method further includes adding each tunnel of the plurality of tunnels to one of a plurality of leaf nodes in a hierarchical tree, wherein the hierarchical tree includes a first level of nodes representing remote Internet Protocol (IP) addresses of the plurality of tunnels, a second level of nodes representing local IP addresses of the plurality of tunnels, and leaf nodes which are each associated with one or more of the plurality of tunnels. The method also includes determining, for each node of the nodes in the hierarchical tree, a score based on at least a sum of scores of tunnels associated with leaf node descendants of the node, and determining, starting from a root node of the hierarchical tree, a number of buckets to assign to each node of the nodes in the hierarchical tree as a ratio of a score of the node to a sum of scores of all sibling nodes of the node. In addition, the method includes selecting one or more tunnels associated with leaf nodes of the hierarchical tree which have been assigned buckets, and directing network traffic through one or more of the select tunnels.

Further embodiments provide a non-transitory computer-readable medium that includes instructions that, when executed, enable a computer to implement one or more aspects of the above method, and a computer system programmed to implement one or more aspects of the above method.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a computing system in which one or more embodiments may be implemented.

FIG. 2 illustrates in greater detail one of the servers of the computing system in FIG. 1, according to an embodiment.

FIG. 3 is a flow diagram depicting a method of avoiding congestion and high latency in a network, according to an embodiment.

FIG. 4 illustrates an approach for selecting among tunnels based on performance of the tunnels, according to an embodiment.

FIG. 5 is a flow diagram depicting a method of selecting tunnels to send network traffic through, according to an embodiment.

DETAILED DESCRIPTION

Embodiments disclosed herein relate to techniques for selecting tunnels to steer network traffic through so as to avoid congestion hot-spots and achieve better throughput and latency. Foo-over-UDP (FOU) tunnels are used herein as an example of internet protocol (IP) tunnels through which network traffic may be sent, but it should be understood that techniques disclosed herein are also applicable to other types of tunnels. Tunneling encapsulates packets constructed in one protocol format within another protocol for transmission over a network, such that the packets that are encapsulated appear as data to the network. FOU in particular is a user datagram protocol (UDP) header encapsulation/tunneling mechanism. Any IP protocol can be encapsulated using FOU, and the FOU UDP encapsulation may provide advantages such as Network Overlay creation, hardware/software optimizations such as Receive Side Scaling (RSS) and Equal Cost Multipath (ECMP) routing, UDP checksum offload, etc. In one embodiment, multiple FOU tunnels are created between two endpoints, with each FOU tunnel having a distinct source port. As a result of the distinct source ports, routers that compute hashes of packet fields in order to distribute traffic flows across network paths will compute distinct hash values for each of the FOU tunnels, and probes may be scheduled to measure network metrics, such as latency and liveliness, of each of the FOU tunnels.

A load balancer uses the measured network metrics to select particular FOU tunnel(s) to send traffic through so as to avoid congestion and high-latency hotspots in the network. In one embodiment, the load balancer selects FOU tunnels in a manner that is fair across source and destination IP addresses. In such a case, scores are assigned to the source and destination IP addresses based on sums of scores assigned to tunnels having those local and remote IP addresses based on the tunnels' performance metrics. The load balancer then splits a number of buckets across the source and destination IP addresses, and ultimately across the tunnels, based on the assigned scores. The tunnels that are assigned buckets may then be selected to send traffic through.

Steering Network Flows Away from Congestion and High Latency Hotspots

FIG. 1 is a block diagram of a computing system 100 in which one or more embodiments may be implemented. As shown, servers 110 and 120 are in communication over a network, and routers 130, 140, and 150 forward packets through the network. The network may generally be a wide area network (WAN), such as the Internet, or a local area network (LAN), such as a network within a data center with multiple routers. In one embodiment, servers 110 and 120 may be virtual appliances. Virtual appliances are pre-configured virtual machines (VMs) with software appliances installed therein. For example, servers 110 and 120 may be gateway virtual appliances in a hybrid cloud computing system, with one of the virtual appliance servers running in the cloud and the other virtual appliance server running in an on-premise data center. In such a case, clients in the cloud may connect to the server running in the data center, and clients in the data center may connect to the server running in the cloud, to communicate with each other. Alternatively, servers 110 and 120 may be physical servers. Although two servers 110 and 120 are shown, it should be understood that techniques disclosed herein may also be employed with more than two servers. Further, servers 110 and 120 are used herein as examples of endpoints, but it should be understood that techniques disclosed herein are also applicable to other types of endpoints, such as personal computers (PCs), smart phones, tablets, and the like.

As shown, two ECMP paths 160 and 170 between router 130 and routers 140 and 150, respectively, may be used to route packets from server 110 to server 120. ECMP is a routing strategy in which next-hop packet forwarding to a destination can occur over multiple “best paths” based on routing metric calculations. To balance traffic from server 110 to server 120 across paths 160 and 170, router 130 may compute a hash of certain fields of the packets it receives and distribute traffic flows to network links based on the hash values. For example, a common hash that routers compute is the five-tuple hash of a packet's source IP address, destination IP address, protocol, source port, and destination port. Each such five-tuple identifies a traffic flow, and router 130 distributes traffic flows across paths 160 and 170 based on the five-tuple hash.

Link aggregation, also referred to as link bundling, is another load balancing technique based on hashing mechanisms that routers may use. Link aggregation combines multiple network links into a single logical link in order to increase throughput and provide redundancy. Illustratively, three links 180 ₁₋₃ between router 140 and server 120 are aggregated into a single logical link 185. If each of the three links 180 ₁₋₃ has 1 gigabit bandwidth, then the single link 185 would have a 3 gigabit bandwidth.

In one embodiment, server 110 (and/or server 120) is configured to create multiple FOU tunnels between servers 110 and 120, through which packets may be sent. As discussed, FOU is a unidirectional IP-in-IP or generic routing encapsulation (GRE) tunnel with a user datagram protocol (UDP) header. FOU tunnels may be configured statically on both servers 110 and 120 to create the FOU tunnels. In a particular embodiment, FOU tunnels may be used to wrap Internet Protocol Security (IPsec) tunnels such that multiple IPsec tunnels can go into each FOU tunnel at server 110 and come out at server 120 (or vice versa). Performance parallelism is gained by using the multiple IPsec tunnels. Each FOU tunnel provides bundling and abstraction of IPsec tunnels, requiring only one public IP address for the FOU tunnel on each side and permitting the IPsec tunnels to use private IP address spaces.

It should be understood that the UDP source port of different connecting clients may differ, while the destination port of the server being connected to may generally stay the same. In one embodiment, server 110 creates multiple FOU tunnels between servers 110 and 120 with the same source IP address, destination IP address, and destination port, but different source ports. The source port of a FOU tunnel can be explicitly programmed when creating a FOU interface. For example, 64 or 128 FOU tunnels may be created, each with the same IP endpoints but a unique source port. As discussed, routers such as router 130 compute hashes of packet fields to distribute flows across ECMP paths. Assuming that a five-tuple hash of each packet's source IP address, destination IP address, protocol, source port, and destination port is computed, packets sent via the multiple FOU tunnels may hash to different paths as a result of the different source ports assigned to the FOU tunnels. For example, router 130 may hash values for packets sent via two FOU tunnels and distribute the packets of those FOU tunnels to paths 160 and 170, respectively, based on the computed hash values. It should be understood that the performance of some FOU tunnels may be better than others due to the path the FOU tunnels' traffic takes.

In one embodiment, a traffic monitor running in server 110 determines performance metric(s) for each of the FOU tunnels. Examples of such metrics include latency, liveliness, throughput, and packet loss. Server 110 then dynamically load balances traffic across the multiple FOU tunnels based on the metric(s) determined for the FOU tunnels. That is, server 110 picks substantially optimal ECMP path(s) associated with one of the FOU tunnels between servers 110 and 120 based on the measured performance of the FOU tunnels, and then encapsulates traffic (e.g., IPsec tunnels) with the picked FOU tunnel.

FIG. 2 illustrates in greater detail server 110 of the computing system 100 shown in FIG. 1, according to an embodiment. Although a physical server 110 is shown, it should be understood that, in an alternative embodiment, one or both endpoints may be virtual appliances running in host computer systems. As shown, server 110 is constructed on a conventional hardware platform. Illustratively, hardware 111 of server 110 includes a central processing unit (CPU) 112 that retrieves and executes programming instructions stored in a memory 113 and also stores and retrieves application data residing in memory 113. Hardware 111 further includes a network interface controller (NIC) 114 connecting server 110 to a network, such as the Internet or a local area network (LAN). In addition, hardware 111 may also include an I/O device interface (not shown) connecting I/O devices (e.g., keyboard, display and mouse devices) to server 110.

As shown, an operating system (OS) kernel 115 runs in server 110, and configuration engine 116, load balancer 117, link monitor 118, modified one-way ping (owamp) 119 a, and fping 119 b applications run on OS kernel 115. For example, OS kernel 115 may be a Linux® kernel. In one embodiment, configuration engine 116 is responsible for configuring server 110 with all the necessary routing and rules to forward traffic, and configuration engine 116 may also configure and manage software-defined wide area network (SD-WAN) features. In particular, configuration engine 116 is configured to receive configuration information from a management application (not shown) and create multiple FOU tunnels, e.g. 64 or 128 tunnels, according to the configuration information. For example, the configuration information may be input by a user into the management application, and FOU tunnels may be configured statically based on the configuration information. For each FOU tunnel, configuration engine 116 may create an IP rule and route to reach an IP address of the remote side, as well as an IP rule and route to use the FOU tunnel for multiple (e.g., 5) IPsec tunnel IPs. In one embodiment, the configuration information used to create the FOU tunnels may include information specifying FOU tunnels with the same IP source address, IP destination address, and destination port, but different source ports. As discussed, packets sent through such FOU tunnels having different source ports may be routed along different paths as a result of five-tuple hashing performed by routers. Further, some of the FOU tunnels may be better than others due to the path the FOU tunnels' traffic takes.

Modified owamp and fping applications 119 a and 119 b send end-to-end pings from server 110 to server 120 through the multiple FOU tunnels to determine latency and liveliness of each of the tunnels, respectively, which can in turn be used to identify better FOU tunnels through which traffic should be sent. Owamp may also be used to authenticate the FOU tunnels, based on a probe response. Although owamp and fping are used herein as examples, it should be understood that other network measurements such as throughput, packet loss, latency drop, and the like may be used in addition to, or in lieu of, owamp and fping. Unlike traditional ping, owamp is unidirectional and generally requires two channels to be opened, a test channel over which unidirectional packets are sent and a bidirectional control channel over which latency information is collected. In one embodiment, owamp is modified to instead use relative latency of the FOU tunnels, rather than absolute latency, as discussed in greater detail below.

Link monitor 118 is configured to measure network metrics, such as latency and liveliness, for multiple FOU tunnels created by configuration engine 116 using, e.g., the modified owamp and fping applications 119 a and 119 b. If there are many FOU tunnels, probing the FOU tunnels may use a lot of processor and disk resources (in the case of owamp). In one embodiment, link monitor 118 reduces the strain on resources by scheduling monitoring to occur periodically, as well as in response to particular events, and not creating continuous probes for all the FOU tunnels. For example, link monitor 118 may schedule fping to run once every second or few seconds to check liveliness of the FOU tunnels, and link monitor 118 may schedule the modified owamp to run once every one or two minutes to measure latency of the FOU tunnels. These probe frequencies are based on the assumption that latency does not change as often as liveliness, and because fping uses ICMP packets while Owamp requires a control connection and uses UDP packets that encapsulate more information and is more expensive to run, typically taking a few seconds for each FOU tunnel. To help ensure fairness in probe scheduling, link monitor 118 may create a separate probe scheduler for each local-IP and remote-IP pair, thereby ensuring that probes of a slow WAN link are not blocking a faster link. The probe schedulers may also be triggered to run probes in parallel (e.g., 4 at a time). Further, different schedulers may be used for static FOU tunnels and dynamic FOU tunnels that are created in response to detecting network address translation (NAT). In addition, link monitor 118 may measure network metrics in response to events such as new network adapters being added or a configuration change, among other things.

In one embodiment, a modified owamp technique may be used to determine FOU tunnel latency. One-way probing using owamp traditionally requires time synchronization of server clocks, e.g., using network time protocol (NTP), to obtain an exact latency measurement. However, assuming server clocks are not synchronized, the modified owamp technique is still able to determine relative latencies of FOU tunnels, as the source and destination that the FOU tunnels originate and end in are the same. In the modified owamp technique, owamp application 119 a first sends server 110's time to server 120 as an initial time synchronization. This time is stored in server 120 and used to determine latencies. Link monitor 118 then compares the latencies of the different FOU tunnels to determine relative latencies. For example, if the latency of one FOU tunnel is measured as 10 milliseconds and the latency of another FOU tunnel is measured as 100 milliseconds, then link monitor 118 may determine that the first FOU tunnel has the lower relative latency, even though 10 milliseconds and 100 milliseconds may not be the exact latencies which would require, e.g., NTP synchronization to obtain.

Load balancer 117 determines which FOU tunnel to send traffic through based on the network metrics obtained by link monitor 118 and implements policy-based routing by programming routing tables, such as the Linux® iptables mangle table, so that traffic flows are encapsulated using the determined FOU tunnel. In one embodiment, all Encapsulating Security Payload (ESP) and Internet Key Exchange (IKE) traffic will use the mangle table to mark packets with a firewall mark (fwmark) of the determined FOU tunnel, and the fwmark is further used in the Linux® ip rule table to derive the route table for forwarding the packets in to the determined FOU tunnel's interface. IKE traffic may then use the determined FOU tunnel to negotiate an IPsec tunnel.

Any feasible selection algorithm may be used to select the FOU tunnel to use. For example, load balancer 117 may select one of multiple FOU tunnels through which server 120 can be reached and that has the lowest latency, and load balancer 117 may then program routing tables to encapsulate a number of IPsec tunnels with the selected FOU tunnel. In one embodiment, load balancer 117 may give additional weighting to FOU tunnel(s) that are currently in use when determining which FOU tunnel to send traffic through. For example, a latency increase may be temporary, or the owamp measurement may be incorrect, and the additional weighting given to the currently used FOU tunnel(s) may help avoid switching to other FOU tunnel(s) unnecessarily.

FIG. 3 is a flow diagram depicting a method 300 of avoiding congestion and high latency in a network, according to an embodiment. As shown, method 300 begins at step 310, where configuration engine 116 creates multiple tunnels routed across distinct network paths between server 110 and server 120. In one embodiment, the tunnels are IP tunnels such as FOU tunnels with different source ports, and routers which use hashing mechanisms to load balance traffic flows may compute distinct hashes for traffic through each of the tunnels and send such traffic over distinct network paths. As discussed, configuration engine 116 may create such tunnels according to, e.g., configuration information provided by a management application. For example, 64 or 128 FOU tunnels between servers 110 and 120 may be created.

At step 320, link monitor 118 uses probes to determine performance metric(s) for each of the tunnels. The performance metric(s) may include one or more of latency, liveliness, throughput, packet loss, and latency drop, among other things. In one embodiment, link monitor 118 may use a modified owamp technique to measure relative latency and fping to measure liveliness of each of the tunnels. The modified owamp may also be used to authenticate the tunnels. As discussed, the modified owamp may include sending one endpoint's time to the other endpoint for an initial time synchronization and then using the initial time and timing contained in later transmitted packets to determine latency of each of the tunnels, which may then be compared to determine the tunnels' relative latencies. In one embodiment, link monitor 118 creates two sets of schedulers for monitoring the tunnels, one for running the modified owamp to measure one-way latency every one or two minutes, and another for running fping to measure liveliness every one or a few seconds. Such schedulers are triggered periodically and may run multiple probes in parallel. A separate probe scheduler may be created for each local-IP and remote-IP pair to ensure that probes of a slow WAN link are not blocking a faster link, and different schedulers may be used for static FOU tunnels and dynamic FOU tunnels. In addition to the periodic probing, probes may also be sent in response to events such as new network adapters being added or a configuration change, among other things.

At step 330, load balancer 117 selects one of the tunnels to direct traffic through based on the determined performance metric(s). As discussed, at any given point in time, there are multiple tunnels (e.g., FOU tunnels) to the destination, one for each source port, and load balancer 117 is responsible for determining the best tunnel for a given traffic flow. In one embodiment, load balancer 117 receives determined performance metric(s) from link monitor 118 and selects one of the tunnels to use based on those metric(s). The selection algorithm may be as simple as, e.g., selecting one of the tunnels having a lowest latency and through which the other endpoint can be reached, although any feasible algorithm may be used. In one embodiment, load balancer 117 may give additional weighting to tunnel(s) that are currently in use.

After selecting a tunnel at step 330, load balancer 117 programs routing tables to encapsulate packets with the selected tunnel at step 340. For example, load balancer 117 may program the routing tables to implement policy-based routing for IPsec packets going into FOU tunnels. Method 300 then returns to step 320, where link monitor 118 determines additional performance metric(s) for each of the tunnels. That is, the tunnels are continuously monitored for changes and routing may be re-programmed based on the changes.

Selecting Tunnels to Send Network Traffic Through

FIG. 4 illustrates an approach for selecting among tunnels based on performance of the tunnels, according to an embodiment. As shown in panel A, multiple tunnels, which are shown as FOU tunnels F_(1-N) have been created for communications between server 410 and server 420. For illustrative purposes, it will be assumed that 64 FOU tunnels have been created, and 8 buckets are being used to select 5 FOU tunnels for actual use in sending network traffic. For example, 5 IPsec tunnels may be established between a pair of virtual appliances (e.g., gateway appliances or layer 2 concentrator appliances) in a hybrid cloud computing system, such as that described in the patent application entitled “Creating Layer 2 Extension Networks in a Hybrid Cloud Computing System” (Attorney Docket No. D222.02). In such a case, the virtual appliances sending traffic on the 5 IPsec tunnels may pick, for each of the IPsec tunnels, a FOU tunnel among a number of FOU tunnels to use in encapsulating the IPsec traffic. As discussed, this approach of wrapping IPsec tunnels in FOU tunnels requires use of only one public IP address of the FOU tunnel on each side (rather than potentially multiple IPsec tunnel IP addresses) and permits the IPsec tunnels to use private IP address spaces. It should be understood, however, that techniques disclosed herein for selecting among tunnels may also be employed to select other types and numbers of tunnels and in other circumstances.

As discussed, configuration engine 116 may create multiple FOU tunnels with the same IP source address, IP destination address, and destination port, but different source ports. Illustratively, FOU tunnels have been created from server 410 to server 420 with source IP addresses A and B; destination IP addresses A′, B′, and C; and multiple different source ports (not shown). Packets sent through FOU tunnels having the same source and destination IP addresses but different source ports may still be routed along different paths 440 _(i) as a result of five-tuple hashing performed by routers 430 _(i), and some of the FOU tunnels may be better than others due to the path taken. In one embodiment, link monitor 118 uses probes to determine performance metric(s) for each of the FOU tunnels, such as latency, liveliness, throughput, packet loss, and/or latency drop, according to probing techniques discussed above. In turn, load balancer 117 uses the determined performance metric(s) to select the top FOU tunnels (e.g., the top 5 FOU tunnels) for use in encapsulating network traffic (e.g., IPsec tunnel traffic).

Panel B illustrates the selection technique load balancer 117 employs in one embodiment. Illustratively, load balancer 117 first determines scores for each of FOU tunnels F_(1-N) based on performance metrics it receives for that FOU tunnel. In one embodiment, load balancer 117 may weight the scores based on user-defined weights for each of the FOU tunnels F_(1-N) if, e.g., the user has a preference for some FOU tunnels over others. In another embodiment, load balancer 117 may increase the score of FOU tunnels currently being used (e.g., by 75%) to give preference to those tunnels and avoid flapping the selection of tunnels.

Having determined scores for individual FOU tunnels F_(1-N), load balancer 117 further determines scores for each of the local and remote Internet Protocol (IP) addresses of the FOU tunnels F_(1-N), which are the source and destination IP addresses, respectively, in the case of FOU tunnels but need not be in other cases. Illustratively, load balancer 117 adds each FOU tunnel F_(1-N) to a leaf node in a hierarchical tree 400 that includes a root node 450, a first level of nodes 460 and 462 representing local Internet Protocol (IP) addresses of the FOU tunnels A and B; a second level of nodes 470, 472, and 474 representing remote IP addresses of the FOU tunnels A′, B′, and C; and leaf nodes that each represent FOU tunnels having the local and remote IP addresses of the leaf node's ancestor nodes (e.g., FOU tunnels F₁- and F₂ have local IP address A and remote IP address A′ of ancestor nodes 460 and 470, respectively).

Load balancer 117 then traverses hierarchical tree 400 a first time to determine, for each node in the tree 400, a score that is a sum of scores of tunnels associated with leaf node descendants of that node. Illustratively, FOU tunnels F₁, F₂, and F_(N) have scores of 5, 10, and 20, respectively; node 470 representing remote IP address A′ has a score of 40 that is the sum of the scores of 5 and 10 from FOU tunnels F₁ and F₂ as well as scores of other FOU tunnels having remote IP address A′; node 472 representing remote IP address C has a score of 20 that is the sum of the scores of FOU tunnels having remote IP address C; node 474 representing remote IP address B′ has a score of 40 that is the sum of the score of 20 from FOU tunnels F_(N) and the scores of other FOU tunnels having remote IP address B′; node 460 representing local IP address A has a score of 60 that is the sum of the scores of FOU tunnels having local IP address A; node 462 representing local IP address B has a score of 40 that is the sum of the scores of FOU tunnels having local IP address B.

Load balancer 117 further traverses hierarchical tree 400 a second time to determine, starting from root node 450 of hierarchical tree 400 in, e.g., a breadth-first search, a number of buckets to assign to each node in the tree 400 as a ratio of a score of that node to a sum of scores of all sibling nodes in the same level of the tree 400. As discussed, 8 buckets are used in this example. Illustratively, the 8 buckets are split 5 to 3 among nodes 460 and 462 representing local IP addresses A and B, respectively, as the ratio of node 460's score of 60 to the sum of the scores of siblings 460 and 462, which is 100, is 60%, and 60% of 8 is 4.8, which rounds to 5. Similarly, the ratio of 462's score of 40 to the sum of the scores 100 is 40%, and 40% of 8 is 3.2, which rounds to 3. Similarly, the 5 buckets assigned to node 460 are split into 3 buckets for node 470 and 2 buckets for node 472 based on the ratio of node 470's score of 40 and node 472's score of 20 to the sum of the scores of the siblings 470 and 472, which is 60. And the 3 buckets assigned to node 462 are assigned to node 474, which has no sibling nodes.

After splitting the 8 buckets among the remote IP address nodes 470, 472, and 474, load balancer 474 further selects tunnels from leaf nodes 480, 482, and 484 that have been assigned buckets. Network traffic, such as traffic on the 5 IPsec tunnels discussed above, may then be sent through one or more of those selected FOU tunnels (e.g., 5 of 8 selected tunnels) by programming routing tables to encapsulate packets with the one or more selected tunnels. Returning to the example above with 5 IPsec tunnels and 8 buckets, not all of the buckets can be used at once, and one embodiment may round-robin across the 8 buckets. It should be understood that the number of tunnels associated with each of leaf nodes 480, 482, and 484 may be greater than the number of buckets assigned to that leaf node. For example, there may be 30 FOU tunnels with local IP address A, remote IP address A′, and different source ports, and the 3 buckets assigned to node 480 would need to be divided among those 30 FOU tunnels. In one embodiment, load balancer 117 divides buckets among tunnels having the same local and remote IP addresses by sorting those tunnels based on their scores, and then splitting the buckets based on weighted averages of those scores (i.e., the individual tunnel scores are divided by the sum of the scores of all tunnels having the same local and remote IP addresses), starting with the tunnels with highest weighted averages. It should be understood that the buckets may be exhausted by assigned them to, e.g., the first one or few tunnels if the weighted averages of those one or few tunnels are sufficiently high.

Fairness across source and destination IP address pairs may be achieved by selecting tunnels according to the discussed approach. As a result, multiple well performing tunnels may be picked to send traffic through while not overwhelming any particular tunnel.

FIG. 5 illustrates a method 500 of selecting tunnels to send network traffic through, according to an embodiment. In one embodiment, method 500 may be employed by load balancer 117 in step 330 of method 300, discussed above, to select tunnels, and load balancer 117 may then program routing tables to encapsulate packets with the selected tunnels according to step 340. In a particular embodiment, load balancer 117 may select FOU tunnel(s) and encapsulate traffic on IPsec tunnels with the selected FOU tunnel(s).

As shown, method 500 begins at step 510, where load balancer 117 receives performance metric(s) for each of a number of tunnels. In one embodiment, the tunnels are IP tunnels such as the FOU tunnels, discussed above, that are created with different source ports. As described with respect to steps 320-330 of method 300, link monitor 118 may use probes to determine tunnel performance metric(s), such as latency, liveliness, throughput, packet loss, and latency drop, among other things. In turn, load balancer 117 receives determined performance metric(s) from link monitor 118 and selects tunnels to direct traffic through based on those performance metric(s).

At step 520, load balancer 117 determines scores for the tunnels based on the received performance metric(s). The scores may be determined in any feasible manner, such as by taking a weighted sum of the received performance measurement(s). In one embodiment, the scores may also be weighted by user-defined weights for each of the tunnels if, e.g., the user has a preference for one tunnel over another. In another embodiment, load balancer 117 may avoid flapping the selection of tunnels by giving preference to tunnels already in use over other tunnels, by increasing the score of in-use tunnels by a predefined amount (e.g., 75%).

At step 530, load balancer 117 adds each tunnel to a leaf node in a hierarchical tree in which leaf nodes represent tunnels, nodes of another level represent remote IP addresses of the tunnels, and nodes of yet another level represent local IP addresses of the tunnels. An example of such a hierarchical tree is the tree 400 discussed above with respect to FIG. 4.

At step 540, load balancer 117 determines a score for each node in the hierarchical tree as a sum of the scores of all tunnels that are associated with leaf node descendants of the node. In one embodiment, load balancer 117 traverses the hierarchical tree from the leaf nodes up to the root node, adds up the scores of tunnels under each node in the tree to determine a total score for the node, and assigns the determined total scores of each node to that node.

At step 550, load balancer 117 determines, beginning from the root node, a number of buckets to assign to each node of the hierarchical tree as a ratio of the score of that node to a total score of all sibling nodes. In one embodiment, load balancer 117 traverses the hierarchical tree from the root node down in, e.g., a breadth-first search, and load balancer 117 assigns buckets to the nodes at each level of the tree based on the ratio of the score of that node to the sum of the scores of all sibling nodes at the same level of the tree.

At step 560, load balancer 117 selects one or more tunnels associated with leaf nodes of the hierarchical tree that have been assigned buckets. In one embodiment, load balancer 117 sorts the tunnels associated with a leaf node based on their scores, and then splits the buckets that have been assigned to the leaf node among the associated tunnels based on weighted averages of their scores. That is, load balancer 117 divides the scores of each tunnel associated with the leaf node by the sum of the scores of all other associated tunnels that have the same local and remote IP addresses, and then assigns buckets to tunnels with the highest such weighted averages based on the weighted average values.

Advantageously, techniques disclosed herein permit network traffic to be steered away from congestion hot-spots to achieve better throughput and latency in networks, such as the Internet, where the transit path is not controllable by the user. Further, techniques disclosed herein for selecting tunnels to send traffic through are fair across WAN links and IP endpoints, where a given WAN link may have multiple tunnels and there may be multiple WAN links. As a result, multiple well performing tunnels may be selected to send traffic through while not overwhelming any particular tunnel.

Certain embodiments as described above involve a hardware abstraction layer on top of a host computer. The hardware abstraction layer allows multiple contexts to share the hardware resource. In one embodiment, these contexts are isolated from each other, each having at least a user application running therein. The hardware abstraction layer thus provides benefits of resource isolation and allocation among the contexts. In the foregoing embodiments, virtual machines are used as an example for the contexts and hypervisors as an example for the hardware abstraction layer. As described above, each virtual machine includes a guest operation system in which at least one application runs. It should be noted that these embodiments may also apply to other examples of contexts, such as containers not including a guest operation system, referred to herein as “OS-less containers” (see, e.g., www.docker.com). OS-less containers implement operating system-level virtualization, wherein an abstraction layer is provided on top of the kernel of an operating system on a host computer. The abstraction layer supports multiple OS-less containers each including an application and its dependencies. Each OS-less container runs as an isolated process in user space on the host operating system and shares the kernel with other containers. The OS-less container relies on the kernel's functionality to make use of resource isolation (CPU, memory, block I/O, network, etc.) and separate namespace and to completely isolate the application's view of the operating environments. By using OS-less containers, resources can be isolated, services restricted, and processes provisioned to have a private view of the operating system with their own process ID space, file system structure, and network interfaces. Multiple containers can share the same kernel, but each container can be constrained to only use a defined amount of resources such as CPU, memory and I/O.

The various embodiments described herein may employ various computer-implemented operations involving data stored in computer systems. For example, these operations may require physical manipulation of physical quantities usually, though not necessarily, these quantities may take the form of electrical or magnetic signals where they, or representations of them, are capable of being stored, transferred, combined, compared, or otherwise manipulated. Further, such manipulations are often referred to in terms, such as producing, identifying, determining, or comparing. Any operations described herein that form part of one or more embodiments of the invention may be useful machine operations. In addition, one or more embodiments of the invention also relate to a device or an apparatus for performing these operations. The apparatus may be specially constructed for specific required purposes, or it may be a general purpose computer selectively activated or configured by a computer program stored in the computer. In particular, various general purpose machines may be used with computer programs written in accordance with the teachings herein, or it may be more convenient to construct a more specialized apparatus to perform the required operations.

The various embodiments described herein may be practiced with other computer system configurations including hand-held devices, microprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like.

One or more embodiments of the present invention may be implemented as one or more computer programs or as one or more computer program modules embodied in one or more computer readable media. The term computer readable medium refers to any data storage device that can store data which can thereafter be input to a computer system computer readable media may be based on any existing or subsequently developed technology for embodying computer programs in a manner that enables them to be read by a computer. Examples of a computer readable medium include a hard drive, network attached storage (NAS), read-only memory, random-access memory (e.g., a flash memory device), a CD (Compact Discs), CD-ROM, a CD-R, or a CD-RW, a DVD (Digital Versatile Disc), a magnetic tape, and other optical and non-optical data storage devices. The computer readable medium can also be distributed over a network coupled computer system so that the computer readable code is stored and executed in a distributed fashion.

Although one or more embodiments of the present invention have been described in some detail for clarity of understanding, it will be apparent that certain changes and modifications may be made within the scope of the claims. Accordingly, the described embodiments are to be considered as illustrative and not restrictive, and the scope of the claims is not to be limited to details given herein, but may be modified within the scope and equivalents of the claims. In the claims, elements and/or steps do not imply any particular order of operation, unless explicitly stated in the claims.

Plural instances may be provided for components, operations or structures described herein as a single instance. Finally, boundaries between various components, operations and datastores are somewhat arbitrary, and particular operations are illustrated in the context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within the scope of the invention(s). In general, structures and functionality presented as separate components in exemplary configurations may be implemented as a combined structure or component. Similarly, structures and functionality presented as a single component may be implemented as separate components. These and other variations, modifications, additions, and improvements may fall within the scope of the appended claims(s). 

1. A computer-implemented method of selecting tunnels to send network traffic through, comprising: determining one or more performance metrics for each of a plurality of tunnels routed across distinct network paths between two endpoints; determining scores for each tunnel of the plurality of tunnels based on at least performance metrics associated with the tunnel; adding each tunnel of the plurality of tunnels to one of a plurality of leaf nodes in a hierarchical tree, wherein the hierarchical tree includes a first level of nodes representing remote Internet Protocol (IP) addresses of the plurality of tunnels, a second level of nodes representing local IP addresses of the plurality of tunnels, and leaf nodes which are each associated with one or more of the plurality of tunnels; determining, for each node of the nodes in the hierarchical tree, a score based on at least a sum of scores of tunnels associated with leaf node descendants of the node; determining, starting from a root node of the hierarchical tree, a number of buckets to assign to each node of the nodes in the hierarchical tree as a ratio of a score of the node to a sum of scores of the node and all sibling nodes of the node in the hierarchical tree; selecting one or more tunnels associated with leaf nodes of the hierarchical tree which have been assigned buckets; and directing network traffic through one or more of the select tunnels.
 2. The method of claim 1, wherein the score assigned to each tunnel of the plurality of tunnels is determined based on at least the performance metrics associated with the tunnel and one or more user-defined weights.
 3. The method of claim 1, wherein each tunnel of the selected one or more tunnels is selected based on at least a ratio of a score of the tunnel to a sum of scores of all tunnels in a same leaf node as the tunnel.
 4. The method of claim 1, further comprising, increasing scores of tunnels which are currently in use by a predefined amount.
 5. The method of claim 1, wherein: the selected tunnels are Foo-over-UDP (FOU) tunnels; and traffic on one or more Internet Protocol Security (IPsec) tunnels are directed through the selected FOU tunnels.
 6. The method of claim 1, wherein each of the plurality of tunnels is associated with a respective source port.
 7. The method of claim 1, wherein the performance metrics include one or more of latency, liveliness, throughput, or packet loss.
 8. The method of claim 1, wherein determining the one or more performance metrics includes probing each of the tunnels.
 9. The method of claim 1, wherein: the plurality of tunnels are tunnels between a first virtual appliance in a first computing system and a second virtual appliance in a second computing system; and the first virtual appliance and the second virtual appliance are used to bridge a first network in the first computing system, a second network in the second computing system, and a wide area network.
 10. A non-transitory computer-readable medium comprising instructions executable by a computer, the computer having one or more physical central processing units (CPUs), wherein the instructions, when executed, cause the computer to perform operations for selecting tunnels to send network traffic through, the operations comprising: determining one or more performance metrics for each of a plurality of tunnels routed across distinct network paths between two endpoints; determining scores for each tunnel of the plurality of tunnels based on at least performance metrics associated with the tunnel; adding each tunnel of the plurality of tunnels to one of a plurality of leaf nodes in a hierarchical tree, wherein the hierarchical tree includes a first level of nodes representing remote Internet Protocol (IP) addresses of the plurality of tunnels, a second level of nodes representing local IP addresses of the plurality of tunnels, and leaf nodes which are each associated with one or more of the plurality of tunnels; determining, for each node of the nodes in the hierarchical tree, a score based on at least a sum of scores of tunnels associated with leaf node descendants of the node; determining, starting from a root node of the hierarchical tree, a number of buckets to assign to each node of the nodes in the hierarchical tree as a ratio of a score of the node to a sum of scores of the node and all sibling nodes of the node in the hierarchical tree; selecting one or more tunnels associated with leaf nodes of the hierarchical tree which have been assigned buckets; and directing network traffic through one or more of the select tunnels.
 11. The computer-readable medium of claim 10, wherein the score assigned to each tunnel of the plurality of tunnels is determined based on at least the performance metrics associated with the tunnel and one or more user-defined weights.
 12. The computer-readable medium of claim 10, wherein each tunnel of the selected one or more tunnels is selected based on at least a ratio of a score of the tunnel to a sum of scores of all tunnels in a same leaf node as the tunnel.
 13. The computer-readable medium of claim 10, the operations further comprising, increasing scores of tunnels which are currently in use by a predefined amount.
 14. The computer-readable medium of claim 10, wherein: the selected tunnels are Foo-over-UDP (FOU) tunnels; and traffic on one or more Internet Protocol Security (IPsec) tunnels are directed through the selected FOU tunnels.
 15. The computer-readable medium of claim 10, wherein each of the plurality of tunnels is associated with a respective source port.
 16. The computer-readable medium of claim 10, wherein the performance metrics include one or more of latency, liveliness, throughput, or packet loss.
 17. The computer-readable medium of claim 10, wherein determining the one or more performance metrics includes probing each of the tunnels.
 18. The computer-readable medium of claim 10, wherein: The plurality of tunnels are tunnels between a first virtual appliance in a first computing system and a second virtual appliance in a second computing system; and the first virtual appliance and the second virtual appliance are used to bridge a first network in the first computing system, a second network in the second computing system, and a wide area network.
 19. A system, comprising: a processor; and a memory, wherein the memory includes a program for avoiding congestion and high latency in a network, the program being configured to perform operations for selecting tunnels to send network traffic through, the operations comprising: determining one or more performance metrics for each of a plurality of tunnels routed across distinct network paths between two endpoints, determining scores for each tunnel of the plurality of tunnels based on at least performance metrics associated with the tunnel, adding each tunnel of the plurality of tunnels to one of a plurality of leaf nodes in a hierarchical tree, wherein the hierarchical tree includes a first level of nodes representing remote Internet Protocol (IP) addresses of the plurality of tunnels, a second level of nodes representing local IP addresses of the plurality of tunnels, and leaf nodes which are each associated with one or more of the plurality of tunnels, determining, for each node of the nodes in the hierarchical tree, a score based on at least a sum of scores of tunnels associated with leaf node descendants of the node, determining, starting from a root node of the hierarchical tree, a number of buckets to assign to each node of the nodes in the hierarchical tree as a ratio of a score of the node to a sum of scores of the node and all sibling nodes of the node in the hierarchical tree, selecting one or more tunnels associated with leaf nodes of the hierarchical tree which have been assigned buckets, and directing network traffic through one or more of the select tunnels.
 20. The system of claim 19, wherein each tunnel of the selected one or more tunnels is selected based on at least a ratio of a score of the tunnel to a sum of scores of all tunnels in a same leaf node as the tunnel. 